/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package edu.au.uq.datamining.entity;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Embeddable;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 *
 * @author oracle
 */
@Embeddable
public class BasicInfoPK implements Serializable {
    @Basic(optional = false)
    @Column(name = "CPERSONA", nullable = false)
    private int cpersona;
    @Basic(optional = false)
    @Column(name = "FHASTA", nullable = false)
    @Temporal(TemporalType.TIMESTAMP)
    private Date fhasta;

    public BasicInfoPK() {
    }

    public BasicInfoPK(int cpersona, Date fhasta) {
        this.cpersona = cpersona;
        this.fhasta = fhasta;
    }

    public int getCpersona() {
        return cpersona;
    }

    public void setCpersona(int cpersona) {
        this.cpersona = cpersona;
    }

    public Date getFhasta() {
        return fhasta;
    }

    public void setFhasta(Date fhasta) {
        this.fhasta = fhasta;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (int) cpersona;
        hash += (fhasta != null ? fhasta.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof BasicInfoPK)) {
            return false;
        }
        BasicInfoPK other = (BasicInfoPK) object;
        if (this.cpersona != other.cpersona) {
            return false;
        }
        if ((this.fhasta == null && other.fhasta != null) || (this.fhasta != null && !this.fhasta.equals(other.fhasta))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "edu.au.uq.datamining.entity.BasicInfoPK[cpersona=" + cpersona + ", fhasta=" + fhasta + "]";
    }

}
